?><?
/// Caching page urls
$url_cache=array();
/// Caching page instances
$page_cache=array();

class cls_instance extends cls_entity{
	function entity(){return "instance";}
	function item($id){return parent::get_db_item(cls_instance::entity(),$id);}
	function by_parent($id){return parent::get_db_items();}
	function by_list($list){return parent::get_db_items(cls_instance::entity(),array(array(otEMP,"instance_id",otIN,$list)));}
	function by_class($class){return parent::get_db_items(cls_instance::entity(),array(array(otEMP,"class_name",otEQ,$class)));}
	function group_asoc($class,$attr){
		$res=ExecSQL("select $attr from instance where class_name='$class' group by $attr");
		$result=array();
		while($row=NextRow($res)){
			$result[$row[$attr]]=$row[$attr];
		}
		return $result;
	}
}